﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;



namespace RoboRun
{

    public sealed partial class TutorialSelectionPage : Page
    {
        public TutorialSelectionPage()
        {
            this.InitializeComponent();
            float screenHeight = ScreenDimensions.obtainScreenHeight();
            float screenWidth = ScreenDimensions.obtainScreenWidth();

            loadPage(screenHeight, screenWidth);
        }

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {


        }

        private void loadPage(float screenHeight, float screenWidth)
        {
            float midPoint = screenWidth / 2 - (screenWidth / 10);
            //Position the title
            tutorialTitle.FontSize = screenHeight / 10;
            tutorialTitle.Margin = new Thickness(midPoint, screenHeight / 20, 0, 0);

            //Position quit button
            quitButton.Margin = new Thickness(screenWidth / 100, screenHeight / 50, 0, 0);
            quitButton.Content = "Back To Main Menu";
            quitButton.Width = double.NaN;
            quitButton.Height = screenHeight / 20;

            //Tutorial 1 Button
            tutorial1Button.Margin = new Thickness(midPoint - 130 * screenWidth / 1920, screenHeight / 80, 0, 0);
            tutorial1Button.Width = screenWidth / 3;
            tutorial1Button.Height = screenHeight / 15;
            tutorial1Button.Content = "Introduction";
            tutorial1Button.FontSize = screenHeight / 30;

            //Tutorial 2 Button
            tutorial2Button.Margin = new Thickness(midPoint - 130 * screenWidth / 1920, screenHeight / 200, 0, 0);
            tutorial2Button.Width = screenWidth / 3;
            tutorial2Button.Height = screenHeight / 15;
            tutorial2Button.Content = "Controls";
            tutorial2Button.FontSize = screenHeight / 30;

            //Tutorial 3 Button
            tutorial3Button.Margin = new Thickness(midPoint - 130 * screenWidth / 1920, screenHeight / 200, 0, 0);
            tutorial3Button.Width = screenWidth / 3;
            tutorial3Button.Height = screenHeight / 15;
            tutorial3Button.Content = "The If Statement";
            tutorial3Button.FontSize = screenHeight / 30;

            //Tutorial 4 Button
            tutorial4Button.Margin = new Thickness(midPoint - 130 * screenWidth / 1920, screenHeight / 200, 0, 0);
            tutorial4Button.Width = screenWidth / 3;
            tutorial4Button.Height = screenHeight / 15;
            tutorial4Button.Content = "For Loop";
            tutorial4Button.FontSize = screenHeight / 30;

            //Tutorial 5 Button
            tutorial5Button.Margin = new Thickness(midPoint - 130 * screenWidth / 1920, screenHeight / 200, 0, 0);
            tutorial5Button.Width = screenWidth / 3;
            tutorial5Button.Height = screenHeight / 15;
            tutorial5Button.Content = "While Loop";
            tutorial5Button.FontSize = screenHeight / 30;

            //Tutorial 6 Button
            tutorial6Button.Margin = new Thickness(midPoint-130*screenWidth/1920, 0, 0, screenHeight / 20);
            tutorial6Button.Width = screenWidth / 3;
            tutorial6Button.Height = screenHeight / 15;
            tutorial6Button.Content = "Gameplay";
            tutorial6Button.FontSize = screenHeight / 30;

        }

        private void tutorial1Button_Click1(object sender, RoutedEventArgs e)
        {
            Frame.Navigate(typeof(Tutorial1));
        }

        private void tutorial2Button_Click(object sender, RoutedEventArgs e)
        {
            Frame.Navigate(typeof(Tutorial2));
        }

        private void tutorial3Button_Click(object sender, RoutedEventArgs e)
        {
            Frame.Navigate(typeof(Tutorial3));
        }

        private void tutorial4Button_Click(object sender, RoutedEventArgs e)
        {
            Frame.Navigate(typeof(Tutorial4));
        }

        private void tutorial5Button_Click(object sender, RoutedEventArgs e)
        {
            Frame.Navigate(typeof(Tutorial5));
        }

        private void tutorial6Button_Click(object sender, RoutedEventArgs e)
        {
            Frame.Navigate(typeof(Tutorial6));
        }

        private void quitButton_Click(object sender, RoutedEventArgs e)
        {
            Frame.Navigate(typeof(MainMenu));
        }

    }
}
